import sys
import select
def timeoutable_input(clue="", timeout=None):
    print(clue, end="")
    i, o, e = select.select([sys.stdin], [], [], timeout)
    if i:
        return sys.stdin.readline().rstrip('\n')
    return None
# 不设置超时
# result = timeoutable_input（）
# print（"Result without timeout:", result）
# 设置超时为5秒
result = timeoutable_input(timeout=5)
print("Result with timeout:", result)

result = timeoutable_input(timeout=5)
print("Result with timeout:", result)
